<template>
	<view class="main">
		<!-- <view class="mian-fuwufei" v-if="userpaytype==4"><text>本次限免（不收取服务费）生效中...</text></view> -->
		<view class="fabu-number-people">
			<text class="fabu-number-people-title-text">发布人数（人）</text>
			<text class="fabu-number-people-text">{{num}}</text>
			<view class="fabu-number-people-service-charge-view">
				<text
					class="fabu-number-people-service-charge-text">{{userpaytype==1||userpaytype==4?'诚意金':'招聘费'}}{{serviceCharge}}元/人</text>
				<image class="fabu-number-people-service-charge-image"
					src="https://images.linglinggong.net/wgc_icon/we23r3244r32432.png" mode="aspectFill"
					@click="ShowModel(userpaytype==1||userpaytype==4?2:2)"></image>
			</view>
			<view v-if="userpaytype==3&&MonthCard_list.length&&userinfo.cardUserType">
				<text class="fabu-number-people-title-text">{{card.levelName}}抵用（人）</text>
				<text class="fabu-number-people-text" style="color: #FE4B28;">-{{num}}</text>
				<view class="fabu-number-people-service-charge-view">
					<text class="fabu-number-people-service-charge-text">剩余{{userinfo.cardNumber}}人</text>
					<image class="fabu-number-people-service-charge-image"
						src="https://images.linglinggong.net/wgc_icon/we23r3244r32432.png" mode="aspectFill"
						@click="ShowModel(3)"></image>
				</view>
			</view>
			<view v-if="isBuyYk&&num<=card.levelNubmer">
				<text class="fabu-number-people-title-text">{{card.levelName}}抵用（人）</text>
				<text class="fabu-number-people-text" style="color: #FE4B28;">-{{num}}</text>
				<view class="fabu-number-people-service-charge-view">
					<text class="fabu-number-people-service-charge-text">剩余{{card.numberPeople}}人</text>
					<image class="fabu-number-people-service-charge-image"
						src="https://images.linglinggong.net/wgc_icon/we23r3244r32432.png" mode="aspectFill"
						@click="ShowModel(3)"></image>
				</view>
			</view>
			<view class="fabu-number-people-service-charge-view-line"></view>
			<view class="fabu-number-people-service-charge-text-view">
				<text v-if="userpaytype!=3" class="xiaoji">小计丨{{num}}*{{isBuyYk?0:serviceCharge}}元<text
						id="zongji">{{(isBuyYk?0:serviceCharge)*num}}</text>元</text>
				<text v-else class="xiaoji">小计丨{{1}}*{{serviceCharge}}元<text id="zongji">{{0}}</text>元</text>
			</view>
		</view>
		<!-- isShowYkType!=-1&& -->
		<view class="fabu-money" v-if="MonthCard_list.length > 0&&isShowCardM" @click="isBuyYk=!isBuyYk">
			<view class="fabu-money-right-image" @click="goToStraightCard()"><text>{{'了解直通卡 >'}}</text></view>
			<text class="month-card-info-title">{{'尊享'+card.levelName}}{{card.zhekou+'折'}}</text>
			<text class="month-card-info-introduce"> 使用周期{{card.duration}}天 \n
				<text>可雇佣{{card.numberPeople}}人，{{Math.round((card.Price/card.numberPeople)*10)/10}}元/人</text> \n
				<!-- Math.round((item.Price/item.numberPeople)*100)/100 --> 单天最高可雇佣{{card.levelNubmer}}人 </text>
			<view class="fabu-money-right-item">
				<view class="fabu-money-right-item-money-view">
					<text style="margin-right: 10rpx;">{{card.Price==youhuiPrice?isShowPrice:card.Price}}</text>
					<text>元</text>
					<view :class="isBuyYk ? 'selected' : 'select'"></view>
				</view>
				<view style="width: 270rpx;" v-if="card.id==1&&isNewMonthCardUser" class="month-card-info-right-youhui">
					<image src="https://images.linglinggong.net/static/icon3/youhui123rewdsf.png" mode="aspectFill">
					</image>
					<text>最高送100元优惠券</text>
				</view>
				<view class="fabu-money-right-item-youhui-view"></view>
			</view>
		</view>
		<view class="fabu-zhifu-type" v-if="userpaytype != 3">
			<view class="payItem" @click="handleSelect(2)">
				<image src="https://images.linglinggong.net/static/icon1/yue.png" mode="aspectFill"></image>
				<text>余额<text class="yueText">￥{{ userinfo.amount/100 }}</text></text>
				<view :class="requestObj.payType==2 ? 'selected' : 'select'"></view>
			</view>
			<view v-if="weixin" class="payItem" @click="handleSelect(3)">
				<image src="https://images.linglinggong.net/static/icon1/wechat.png" mode="aspectFill"></image>
				<text>微信</text>
				<view :class="requestObj.payType==3 ? 'selected' : 'select'"></view>
			</view>
		</view>
		<view class="fabu-zhifu-button-view">
			<view class="fabu-zhifu-button-view-text">
				<!-- 总计<text>{{isBuyYk?MonthCard_list[isShowYkType].Price:serviceCharge*num}}</text>元 -->
				总计<text>{{isBuyYk?card.Price:userpaytype==3?0:serviceCharge*num}}</text>元
			</view>
			<view class="fabu-zhifu-button-view-button" @click="userpaytype != 3?handlePayBond():ykButton()">立即支付</view>
		</view>
		<view class="mask" v-if="isShowmodel">
			<view class="chengyijin-model">
				<view class="chengyijin-model-image">{{isShowmodelType==1?'诚意金':isShowmodelType==2?'服务费':'直通卡'}}</view>
				<view class="chengyijin-model-title">
					<text>{{isShowmodelType==1?'什么是诚意金？':isShowmodelType==2?'什么是服务费？':'什么是直通卡？'}}</text>
				</view>
				<view v-if="isShowmodelType==1">
					<view class="chengyijin-model-view-text">
						<!-- <text>● </text> -->诚意金是保障雇员的权益与用户所产生的约定费用
					</view>
					<view class="chengyijin-model-view-text">
						<!-- <text>● </text> -->诚意金会根据任务节点，可抵扣工人工资或原路返还
					</view>
				</view>
				<view v-if="isShowmodelType==2">
					<view class="chengyijin-model-view-text">
						<!-- <text>● </text> -->如没有招募到雇员，服务费会原路返还
					</view>
					<view class="chengyijin-model-view-text">
						<!-- <text>● </text> -->为提高服务质量，同时兼顾平台可持续健康发展
					</view>
				</view>
				<view v-if="isShowmodelType==3">
					<view class="chengyijin-model-view-text">直通卡是一种限时类活动卡片，购买直通卡后发布任务可进行对应的服务费免除</view>
					<view class="chengyijin-model-title"><text>直通卡的种类有哪些？</text></view>
					<view class="chengyijin-model-view-text">直通卡包括：月卡、半年卡、年卡</view>
				</view>
				<view class="chengyijin-model-button" @click="isShowmodel=false">知道了</view>
			</view>
		</view>
		<!-- 支付密码弹框 -->
		<view v-if="isOpenModal" class="share-modal">
			<view class="main" :class="{'errorpw':isShowPassWordAnimation}">
				<image @click="handleCloseModal" class="close" src="https://images.linglinggong.net/icon1/47.png">
				</image>
				<view class="modal-title">
					<text>请输入钱包支付密码</text>
				</view>
				<view class="modal-content">
					<view class="modal-content-line">
						<u-line color="#ccc"></u-line>
					</view>
					<view class="modal-content-money">
						<view class="rmb">￥</view>
						<view class="rmb-num">
							{{isBuyYk?card.Price:userpaytype==3?0:serviceCharge*num}}.00
						</view>
					</view>
					<view class="modal-content-type">
						<view class="modal-content-type-left">支付方式</view>
						<view class="modal-content-type-right">
							<image src="https://images.linglinggong.net/static/rmb.png" mode="widthFix"></image>
							<text>余额</text>
						</view>
					</view>
				</view>
				<view class="pay-code">
					<input type="number" :focus="focus" v-model="requestObj.payPwd" maxlength="6" @input="getPayCode" />
					<block v-for="(item, index) in ranges" :key="index">
						<view :class="['box', { active: codeIndex === item}]">
							<view class="line"></view>
							<text>{{ codeArr[index] ? codeArr[index] : ''}}</text>
						</view>
					</block>
				</view>
				<view class="repwd" v-if="!isShowForgetPassword" @click="toRePasssWord">忘记密码</view>
				<view class="repwd" style="color: #FE4B28;" v-if="isShowForgetPassword" @click="toRePasssWord">忘记密码
				</view>
				<!-- <view class="button" @click="handleComfirmPay">确认</view> -->
			</view>
		</view>
		<showModalButton v-if="isShowModal" :modalText1="isBuyYk?'距离直通卡只差一步了,':'距离发布只差一步了,'" :modalText2="'确认要取消吗？'"
			:buttonLeftText="'暂时放弃'" :buttonRightText="'继续支付'" :modalTextSize="'36rpx'" :modalTextHeight="'53rpx'"
			:rightButtonColor="'#FE4B28'" @clickLeft="closePayPage()" @clickRight="isShowModal=false"></showModalButton>
		<view class="yk-jianmian" v-if="showYkJianmian">
			<image src="https://images.linglinggong.net/icon1/sadsadsadas.png" mode="aspectFill"
				@load="showYkJianmianTime=3"></image>
			<text class="yk-jianmian-title">发布成功</text>
			<text class="yk-jianmian-cardNumber">消耗抵用{{num}}次，还剩{{userinfo.cardNumber}}次</text>
			<text class="showYkJianmianTime">({{showYkJianmianTime+'S'}})</text>
		</view>
		<u-modal @cancel="handleZf" @confirm="handleZf" cancelText="重新支付" confirmText="已支付" confirmColor="#F39B19"
			:show="isShowZfConf" showCancelButton>
			<view class="slot-content">
				<text style="font-size: 34rpx;padding-bottom: 0;">是否已支付？</text>
			</view>
		</u-modal>
	</view>
</template>
<script>
	import showModalButton from '@/components/showModalButton/showModalButton.vue'
	import Voice from '@/libs/QS-baiduyy.js'
	import {
		Card_of_Number,
		getUserInfo,
		getMonthCardInfo_card_list,
		isToExceedTheTime,
		release_task_card,
		isShowCardmoudel,
	} from '@/libs/unit.js'
	export default {
		watch: {
			showYkJianmianTime() {
				setTimeout(() => {
					this.showYkJianmianTime -= 1
				}, 1000)
			},
			isShowPrice() {
				if (this.isShowPrice != 0 && this.youhuiPrice < this.isShowPrice) {
					if (this.isShowPrice == this.ioriginalPrice) {
						setTimeout(() => {
							this.isShowPrice -= 1
						}, 2000)
					} else {
						setTimeout(() => {
							this.isShowPrice -= 2
						}, 20)
					}
				} else {
					this.isShowPrice = this.youhuiPrice
				}
			},
		},
		data() {
			return {
				requestObj: {
					taskId: '',
					payPwd: '',
					paybegtype: '',
					payType: 2, //0支付宝，1微信，2钱包  //taskId cardId
				},
				monthCardList: '',
				isShowmodel: false,
				isShowmodelType: 1, //1 诚意金 2 服务费 3 月卡
				isShowPassWordAnimation: false, //密码错误执行动画
				isShowForgetPassword: false, //是否弹出忘记密码
				serviceCharge: 0, //保证金
				num: '', //人数
				userinfo: {},
				isNewMonthCardUser: false,
				MonthCard_list: [],
				isShowYkType: 0,
				isBuyYk: false,
				focus: false, //键盘输入焦点
				codeIndex: 1,
				codeArr: [], //密码
				ranges: [1, 2, 3, 4, 5, 6],
				isOpenModal: false,
				isShowModal: false,
				isBackPress: true, //是否拦截返回事件
				userpaytype: 1, //1,诚意金 2服务费 3月卡 4免诚意金
				showYkJianmian: false,
				showYkJianmianTime: 0,
				isShowPrice: 0,
				originalPrice: 0,
				youhuiPrice: 0,
				isShowCardM: true,
				demo: {
					top: 48,
					height: 32
				},
				weixin: true,
				card: {}
			}
		},
		components: {
			showModalButton,
		},
		onReady() {
			//#ifdef MP-ALIPAY
			if (my.canIUse('hideBackHome')) {
				this.navbarInit()
			}
			//#endif
		},
		methods: {
			/* 初始化支付宝小程序navbar */
			navbarInit() {
				my.hideBackHome()
				my.hideAddToDesktopMenu();
			},
			/* 获取小程序导航栏的高度 */
			async getMenuBar() {
				const demo = uni.getMenuButtonBoundingClientRect()
				this.demo.top = demo.top
				this.demo.height = demo.height
				let isHavePayPassword = await this.$fetch(this.$api.v1_Buy_monthly_card, {
					cardId: 0,
					payType: 2,
					payPwd: '1'
				}, 'POST')
				if (isHavePayPassword.msg == "获取不到当前用户支付密码,请先设置") {
					uni.setStorageSync("isHavePayPassword", false)
				} else {
					uni.setStorageSync("isHavePayPassword", true)
				}
			},
			async getPayType() {
				let res = await this.$fetch(this.$api.property_list_by_type_and_key, {
					type: 1,
					key: 'pay_channel_open_list'
				}, 'POST')
				if (res.code != 0) {
					return
				}
				let data = res.data
				if (!data) {
					return
				}
				let dataArr = data.split(',')
				for (var i = 0; i < dataArr.length; i++) {
					if (dataArr[i] == 0) {
						this.zhifubao = true
						this.requestObj.payType = 0
					} else if (dataArr[i] == 5) {
						this.zhifubaole = true
						this.requestObj.payType = 2
					} else if (dataArr[i] == 1) {
						this.weixin = true
					} else if (dataArr[i] == 4) {
						this.weixinle = true
					}
				}
				console.log(dataArr)
			},
			async handleZf() {
				let res = await this.$fetch(this.$api.findUserPayOrder, {}, 'POST')
				if (res.code) {
					uni.showToast({
						title: res.msg,
						icon: 'none'
					})
					setTimeout(() => {
						this.isShowZfConf = false
					}, 500)
					return
				}
				if (!res.code) {
					if (this.isBuyYk) {
						release_task_card(this.requestObj.taskId)
						uni.showToast({
							title: '已成功支付',
							icon: 'none'
						})
						setTimeout(() => {
							this.pageInit()
						}, 800)
						this.isBuyYk = false
						this.handleCloseModal()
						this.showYkJianmian = true
						if (uni.getStorageSync('checked1')) {
							Voice('您的任务已发布，请耐心等待审核')
						}
						setTimeout(() => {
							uni.navigateTo({
								url: '/pages/app-employer/fabu-pay/fabuSucceed/fabuSucceed'
							})
							this.showYkJianmian = false
						}, 3000)
					} else {
						uni.showToast({
							title: '发布成功~',
							icon: 'none'
						})
						setTimeout(() => {
							uni.navigateTo({
								url: '/pages/app-employer/fabu-pay/fabuSucceed/fabuSucceed'
							})
						}, 800)
					}
				} else {
					uni.showToast({
						title: '未支付，请及时支付',
						icon: 'none'
					})
				}
				this.isShowZfConf = false
				uni.removeStorageSync('tempTrade')
				uni.removeStorageSync('wxTempTrade')
				uni.removeStorageSync('iswxzf')
			},
			pageInit() {
				this.$nextTick(function() {
					getUserInfo().then(v => {
						this.userinfo = v
						this.serviceCharge = uni.getStorageSync('property_list_by_type').bondS.split(',')[
							this.userinfo.user.level - 1]
						this.isNewMonthCardUser = this.userinfo.cardUserType == 0 || this.userinfo
							.cardUserType == 4
						this.isExpirationTime = isToExceedTheTime(this.userinfo.cardtime)
						this.isShowYkType = this.getShowYkType(this.userinfo.cardUserType)
						console.log(this.isShowYkType, '判断条件');
						getMonthCardInfo_card_list().then((v) => {
							if (this.userinfo.cardUserType == 0) {
								v.forEach(c => {
									console.log("card->", v)
									if (c.levelName == '月卡') {
										this.originalPrice = this.isNewMonthCardUser ?
											parseInt(c.imgsone) : 0
										this.youhuiPrice = this.isNewMonthCardUser ?
											parseInt(c.cardPrice) : 0
										this.isShowPrice = this.originalPrice
									}
									c.Price = this.isNewMonthCardUser ? parseInt(c
										.cardPrice) : parseInt(c.imgsone)
									c.zhekou = Math.round((c.Price / (c.numberPeople * this
										.serviceCharge) * 10) * 10) / 10
									this.MonthCard_list.push(c)
								})
								this.card = this.MonthCard_list[0];
								return
							}
							v.forEach(c => {
								console.log("card->", v)
								if (c.levelName == '月卡') {
									this.originalPrice = this.isNewMonthCardUser ?
										parseInt(c.imgsone) : 0
									this.youhuiPrice = this.isNewMonthCardUser ? parseInt(c
										.cardPrice) : 0
									this.isShowPrice = this.originalPrice
								}
								c.Price = this.isNewMonthCardUser ? parseInt(c.cardPrice) :
									parseInt(c.imgsone)
								c.zhekou = Math.round((c.Price / (c.numberPeople * this
									.serviceCharge) * 10) * 10) / 10
								this.MonthCard_list.push(c)
								if (c.id == this.userinfo.cardUserType) {
									this.card = c;
								}
							})
							if (this.card && this.MonthCard_list) {
								this.card = this.MonthCard_list[0];
							}
							console.log("MonthCard_list=>", this.MonthCard_list)
							uni.setStorageSync('MonthCard_list', this.MonthCard_list)
						})
					})
				})
			},
			getShowYkType(cardUserType) {
				switch (true) {
					case this.num <= 10:
						return cardUserType <= 1 || cardUserType == 4 ? 0 : -1
						break;
					case this.num <= 15:
						return cardUserType < 2 || cardUserType == 4 ? 1 : -1
						break;
					case this.num <= 20:
						return cardUserType < 3 || cardUserType == 4 ? 2 : -1
						break;
					default:
						return -1
						break;
				}
			},
			goToStraightCard() {
				uni.navigateTo({
					url: '/pages/bossMonthCard/straightCard'
				})
			},
			//选择支付类型
			handleSelect(index) {
				this.requestObj.payType = index
				console.log('支付类型', index)
				if (index == 2) {
					if (uni.getStorageSync('isHavePayPassword') == false) {
						this.setPayPassword()
					}
				}
			},
			// 得到输入的密码
			getPayCode(e) {
				let {
					value
				} = e.detail
				let del = false
				this.requestObj.payPwd = value
				if (value.length < this.codeArr.length) {
					del = true
				}
				this.codeArr.length = value.length
				this.codeArr.fill("●")
				this.codeIndex = this.codeArr.length + 1
				if (del) {
					return
				}
				this.codeArr[value.length - 1] = value[value.length - 1]
				setTimeout(() => {
					if (this.codeArr.length != 0) {
						this.$set(this.codeArr, [this.codeArr.length - 1], "●")
					}
				}, 1000)
				if (this.codeIndex == 7) {
					this.handleComfirmPay()
				}
				console.log('codeArr', this.codeIndex, this.codeArr)
			},
			//点击链接至账户安全。
			toRePasssWord() {
				uni.navigateTo({
					url: '/pages/account-security/account-security'
				})
			},
			// 钱包支付确认
			async handleComfirmPay() {
				let pay_api = ''
				if (this.isBuyYk) {
					pay_api = this.$api.v1_Buy_monthly_card
					this.requestObj.cardId = this.MonthCard_list[this.isShowYkType].id
				} else {
					pay_api = this.$api.v1_pay_bond
				}
				console.log('钱包支付确认', this.requestObj)
				let res = await this.$fetch(pay_api, this.requestObj, 'POST')
				console.log('钱包支付确认', res)
				if (this.isBuyYk && res.code == 0) {
					release_task_card(this.requestObj.taskId)
					uni.showToast({
						title: '购买成功～',
						icon: 'none'
					})
					setTimeout(() => {
						that.pageInit()
					}, 800)
					this.isBuyYk = false
					this.handleCloseModal()
					this.showYkJianmian = true
					setTimeout(() => {
						uni.reLaunch({
							url: '/pages/app-employer/fabu-pay/fabuSucceed/fabuSucceed'
						})
						this.showYkJianmian = false
					}, 3000)
					return
				}
				if (res.code) {
					this.emptyInput()
					uni.showToast({
						title: res.msg,
						icon: 'none'
					})
					if (res.msg == '结算任务失败请设置支付密码') {
						setTimeout(() => {
							uni.navigateTo({
								url: '/pages/account-security/account-security'
							})
						}, 400)
					}
					return
				} else {
					this.handleCloseModal()
					Voice("您的任务已发布，请耐心等待审核")
					uni.showToast({
						title: '发布成功~',
						icon: 'none'
					})
					setTimeout(() => {
						uni.reLaunch({
							url: '/pages/app-employer/fabu-pay/fabuSucceed/fabuSucceed'
						})
					}, 800)
				}
			},
			// 确认发布，
			async handlePayBond() {
				let pay_api = ''
				let that = this
				if (this.isBuyYk) {
					pay_api = this.$api.v1_Buy_monthly_card
					this.requestObj.cardId = this.MonthCard_list[this.isShowYkType].id
				} else {
					pay_api = this.$api.v1_pay_bond
				}
				// 支付宝支付
				if (this.requestObj.payType == 0) {
					let res = await this.$fetch(pay_api, this.requestObj, 'POST')
					console.log('支付宝', res.msg)
					if (res.code) return uni.showToast({
						title: res.msg,
						icon: 'none'
					})
					uni.requestPayment({
						provider: 'alipay',
						orderInfo: res.msg, //微信、支付宝订单数据
						success: function(res) {
							console.log('success:' + JSON.stringify(res));
							if (that.isBuyYk) {
								release_task_card(this.requestObj.taskId)
								uni.showToast({
									title: '购买成功～',
									icon: 'none'
								})
								setTimeout(() => {
									that.pageInit()
								}, 800)
								that.isBuyYk = false
								that.handleCloseModal()
								this.showYkJianmian = true
								setTimeout(() => {
									uni.reLaunch({
										url: '/pages/app-employer/fabu-pay/fabuSucceed/fabuSucceed'
									})
									this.showYkJianmian = false
								}, 3000)
								return
							}
							uni.showToast({
								title: '发布成功~',
								icon: 'none'
							})
							setTimeout(() => {
								uni.reLaunch({
									url: '/pages/app-employer/fabu-pay/fabuSucceed/fabuSucceed'
								})
							}, 800)
						},
						fail: function(err) {
							console.log('fail:' + JSON.stringify(err));
						}
					})
				} else if (this.requestObj.payType == 2) {
					if (uni.getStorageSync('isHavePayPassword') == false) {
						this.setPayPassword()
					} else {
						this.isOpenModal = true
						this.focus = true
					}
				} else if (this.requestObj.payType == 3) {
					//微信支付
					console.log(this.requestObj, '123')
					this.requestObj.paybegtype = 'wx'
					let res = await this.$fetch(pay_api, this.requestObj, 'POST')
					if (res.code) return uni.showToast({
						title: res.msg,
						icon: 'none'
					})
					const info = res.data
					console.log(res.data)
					this.MP_WXPay(info)
				}
			},
			/* 微信小程序支付 */
			MP_WXPay(info) {
				uni.requestPayment({
					provider: 'wxpay',
					timeStamp: info.timeStamp, //时间戳
					nonceStr: info.nonceStr,
					package: info.package,
					signType: info.signType,
					paySign: info.paySign,
					success: res => {
						console.log('success:' + JSON.stringify(res));
						if (this.isBuyYk) {
							release_task_card(this.requestObj.taskId)
							uni.showToast({
								title: '购买成功～',
								icon: 'none'
							})
							setTimeout(() => {
								this.pageInit()
							}, 800)
							this.isBuyYk = false
							this.handleCloseModal()
							this.showYkJianmian = true
							setTimeout(() => {
								uni.reLaunch({
									url: '/pages/app-employer/fabu-pay/fabuSucceed/fabuSucceed'
								})
								this.showYkJianmian = false
							}, 3000)
							return
						}
						uni.showToast({
							title: '发布成功~',
							icon: 'none'
						})
						setTimeout(() => {
							uni.reLaunch({
								url: '/pages/app-employer/fabu-pay/fabuSucceed/fabuSucceed'
							})
						}, 800)
					},
					fail: err => {
						console.log('fail:' + JSON.stringify(err));
					}
				})
			},
			//清空输入框，更新是否弹出忘记密码标识
			emptyInput() {
				this.isShowPassWordAnimation = true
				this.isShowForgetPassword = true
				this.requestObj.payPwd = ''
				this.codeArr = []
				this.codeIndex = 1
				setTimeout(() => {
					this.isShowPassWordAnimation = false
				}, 1200)
			},
			// 关闭支付弹框
			handleCloseModal() {
				this.isOpenModal = false
				this.requestObj.payPwd = ''
				this.codeArr = []
				this.codeIndex = 1
			},
			// 获取任务详情
			async task_detail(taskId) {
				let res = await this.$fetch(this.$api.task_detail, {
					taskId: taskId
				}, 'POST')
				// console.log('获取任务详情', res.data)
				this.num = res.data.number //任务人数
				this.userpaytype = res.data.userpaytype
				this.pageInit()
			},
			ykButton() {
				if (this.userpaytype == 3) {
					this.showYkJianmian = true
					setTimeout(() => {
						uni.redirectTo({
							url: '/pages/my-job/boss-my-job-new'
						})
						this.showYkJianmian = false
					}, 3000)
					return
				}
			},
			ShowModel(isShowmodelType) {
				isShowmodelType = isShowmodelType == 4 ? 1 : isShowmodelType
				this.isShowmodel = true
				this.isShowmodelType = isShowmodelType
				console.log('asdasdas', this.isShowmodelType, isShowmodelType)
			},
			closePayPage() {
				this.isBackPress = false
				uni.redirectTo({
					url: '/pages/my-job/boss-my-job-new'
				})
			},
			setPayPassword() {
				uni.showModal({
					title: '您还未设置支付密码',
					content: '是否现在就去设置支付密码？',
					success: function(res) {
						if (res.confirm) {
							uni.navigateTo({
								url: '/pages/set-pay-code/set-pay-code'
							})
						} else if (res.cancel) {
							uni.showToast({
								title: '未设置支付密码~',
								icon: 'none'
							})
						}
					}
				})
			},
			onbackBtn() {
				this.isShowModal = this.isBackPress
			}
		},
		onLoad(value) {
			this.pageInit()
			this.requestObj.taskId = value.taskId
			this.task_detail(value.taskId)
			this.isShowCardM = isShowCardmoudel()
			console.log(this.isShowYkType, this.MonthCard_list.length, this.isShowCardM);
		},
		onShow() {
			this.getPayType()
			this.pageInit()
		},
		onShareAppMessage() {
			if (uni.getStorageSync('userType') == 1) {
				return {
					title: "足不出户，免费招工",
					desc: "线上招募零工，工价透明，免费使用",
					path: `/pages/start-n/start-n`,
					imageUrl: 'https://images.linglinggong.net/static/employer-share.jpg',
					success: res => {}
				}
			} else {
				return {
					title: "在家找日结兼职，工种齐全",
					desc: "免费使用，提前在家找日结兼职",
					path: `/pages/start-n/start-n`,
					imageUrl: 'https://images.linglinggong.net/static/employee-share.jpg',
					success: res => {}
				}
			}
		},
	}
</script>
<style lang="less" scoped>
	// #ifdef MP-WEIXIN || MP-TOUTIAO
	.demo {
		position: relative;
		display: flex;
		align-items: center;
		justify-content: center;
		background: #fff;
		font-size: 26rpx;
		width: 100vw;

		.left {
			float: left;
			position: absolute;
			width: max-content;
			height: max-content;
			top: 0;
			bottom: 0;
			left: 0;
			padding-left: 20rpx;
			width: 100rpx;
			margin: auto;

			image {
				width: 19rpx;
				height: 32rpx;
			}
		}
	}

	//#endif
	//#ifdef MP-ALIPAY
	.demo {
		position: relative;
		display: flex;
		align-items: center;
		justify-content: center;
		background: #fff;
		font-size: 26rpx;

		.left {
			position: absolute;
			width: max-content;
			height: max-content;
			top: 0;
			bottom: 0;
			padding-left: 40rpx;
			left: 0;
			margin: auto;
			width: 100rpx;

			image {
				width: 25rpx;
				height: 44rpx;
			}
		}
	}

	// #endif
	.main {
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.marginTop20 {
		margin-top: 20rpx;
	}

	.fabu-number-people {
		width: 690rpx;
		background: #FFFFFF;
		border-radius: 12rpx;
		margin: 20rpx;
	}

	.fabu-money {
		width: 690rpx;
		height: 264rpx;
		background: #FFFFFF;
		border-radius: 12rpx;
		.marginTop20;
		padding-bottom: 20rpx;
	}

	.fabu-zhifu-type {
		width: 690rpx;
		height: 324rpx;
		background: #FFFFFF;
		border-radius: 12rpx;
		.marginTop20;
	}

	.fabu-number-people-title-text {
		font-size: 32rpx;
		font-weight: bold;
		color: #000000;
		line-height: 45rpx;
		display: inline-block;
		margin: 36rpx 0 0 30rpx;
	}

	.fabu-number-people-text {
		font-size: 40rpx;
		font-weight: bold;
		color: #000000;
		line-height: 45rpx;
		float: right;
		display: inline-block;
		margin: 36rpx 30rpx 0 0;
	}

	.fabu-number-people-service-charge-view {
		display: flex;
		flex-direction: row;
		align-items: center;
	}

	.fabu-number-people-service-charge-text {
		font-size: 24rpx;
		font-weight: 500;
		color: #515151;
		line-height: 45rpx;
		margin-left: 30rpx;
		display: inline-block;
	}

	.fabu-number-people-service-charge-image {
		width: 27rpx;
		height: 26rpx;
	}

	.fabu-number-people-service-charge-view-line {
		width: 630rpx;
		height: 1rpx;
		background: #F2F2F2;
		margin: 34rpx auto 30rpx auto;
	}

	.fabu-number-people-service-charge-text-view {
		float: right;
		margin-right: 30rpx;
		padding-bottom: 30rpx;

		.xiaoji {
			font-size: 24rpx;
			font-weight: 500;
			color: #515151;
			line-height: 24rpx;
		}

		#zongji {
			font-size: 52rpx;
			color: #FE4B28;
			margin-left: 8rpx;
		}
	}

	.fabu-money-right-image {
		background-image: url(https://images.linglinggong.net/icon3/fdtyu76899.png);
		background-size: cover;
		width: 246rpx;
		height: 44rpx;
		float: right;

		&>text {
			font-size: 24rpx;
			font-weight: 500;
			color: #FFFFFF;
			line-height: 44rpx;
			float: right;
			margin-right: 30rpx;
		}
	}

	.month-card-info-title {
		margin-top: 32rpx;
		margin-left: 28rpx;
		display: block;
		font-size: 32rpx;
		font-weight: bold;
		color: #000000;
		line-height: 45rpx;
	}

	.month-card-info-introduce {
		margin-top: 32rpx;
		margin-left: 28rpx;
		font-size: 24rpx;
		font-weight: 500;
		color: #515151;
		line-height: 41rpx;
		float: left;
	}

	.fabu-money-right-item {
		float: right;
		margin: 32rpx 30rpx 0 0;
	}

	.fabu-money-right-item-money-view {
		display: flex;
		flex-direction: row;

		&>text:nth-child(1) {
			font-size: 66rpx;
			font-weight: bold;
			color: #FE4B28;
			line-height: 42rpx;
		}

		&>text:nth-child(2) {
			font-size: 24rpx;
			font-weight: 500;
			color: #515151;
			line-height: 66rpx;
			margin-right: 30rpx;
		}
	}

	.payItem {
		width: 630rpx;
		height: 60rpx;
		margin: 36rpx auto;
		display: flex;
		align-items: center;
		justify-content: space-between;

		&>image {
			width: 60rpx;
			height: 60rpx;
		}

		&>text {
			font-size: 26rpx;
			font-weight: 500;
			color: #000000;
			line-height: 36rpx;
			margin-left: 20rpx;
			flex: 1;
		}

		.yueText {
			font-size: 26rpx;
			font-weight: 500;
			color: #A5A5A5;
			line-height: 45rpx;
			margin-left: 20rpx;
		}
	}

	.select {
		width: 42rpx;
		height: 42rpx;
		border: 1px solid #AFAFAF;
		border-radius: 50%;
	}

	.selected {
		width: 46rpx;
		height: 46rpx;
		background-image: url(https://images.linglinggong.net/icon1/hdg.png);
		background-repeat: repeat;
		background-size: 100% 100%;
	}

	.mask {
		width: 100vw;
		height: 100vh;
		background-color: rgba(0, 0, 0, .5);
		position: fixed;
		left: 0;
		top: 0;
	}

	.chengyijin-model {
		width: 630rpx;
		height: 565rpx;
		background: #FFFFFF;
		border-radius: 20rpx;
		position: absolute;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);
	}

	.chengyijin-model-image {
		width: 402rpx;
		height: 92rpx;
		position: relative;
		left: calc(50% - 201rpx);
		top: -32rpx;
		background-image: url(https://images.linglinggong.net/icon3/haopinginfo.png);
		background-size: cover;
		font-size: 40rpx;
		text-align: center;
		font-weight: bold;
		color: #402110;
		line-height: 92rpx;
	}

	.chengyijin-model-title {
		display: inline-block;
		height: 44rpx;
		margin-left: 48rpx;
		background-color: rgba(252, 201, 40, .2);
		border-radius: 22rpx;

		&>text {
			padding: 0 24rpx;
			font-size: 32rpx;
			font-weight: 500;
			color: #F39A16;
			text-align: center;
			line-height: 44rpx;
		}
	}

	.chengyijin-model-view-text {
		width: 534rpx;
		margin: 30rpx auto 0 auto;
		color: #515151;
		font-size: 30rpx;
		line-height: 50rpx;
		margin-bottom: 34rpx;

		&>text {
			font-size: 16rpx;
			color: #FCC928;
		}
	}

	.chengyijin-model-button {
		width: 534rpx;
		height: 78rpx;
		background: #FCC928;
		border-radius: 8rpx;
		text-align: center;
		font-size: 32rpx;
		line-height: 78rpx;
		font-weight: bold;
		color: #402110;
		margin: 0 auto;
	}

	.fabu-zhifu-button-view {
		width: 750rpx;
		height: 138rpx;
		background-color: #FFFFFF;
		position: fixed;
		padding-bottom: 30rpx;
		bottom: 0;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
	}

	.fabu-zhifu-button-view-text {
		font-size: 28rpx;
		font-weight: 400;
		color: #000000;
		margin-left: 30rpx;

		&>text {
			font-size: 52rpx;
			font-weight: bold;
			color: #FE4B28;
		}
	}

	.fabu-zhifu-button-view-button {
		margin-right: 30rpx;
		width: 220rpx;
		height: 88rpx;
		background: #FCC928;
		border-radius: 12rpx;
		text-align: center;
		font-size: 32rpx;
		font-weight: bold;
		color: #402110;
		line-height: 88rpx;
	}

	.share-modal {
		z-index: 11;
		position: fixed;
		bottom: 0;
		height: 100vh;
		width: 100vw;
		background-color: rgba(0, 0, 0, 0.40);
		display: flex;
		align-items: center;
		justify-content: center;

		&>.main {
			position: relative;
			top: -100rpx;
			width: 570rpx;
			// height: 250rpx;
			padding: 30rpx;
			background: #FFFFFF;
			box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.05) inset;
			border-radius: 17px;
			line-height: 40rpx;
			display: flex;
			flex-direction: column;
			align-items: center;

			&>.modal-title {
				font-size: 32rpx;
				font-weight: 600;
				margin-top: 20rpx;

				// margin: 30rpx 0 50rpx;
				&>.imgs {
					position: relative;

					image {
						position: absolute;
						top: 0rpx;
						bottom: 0;
						right: -80rpx;
						width: 50rpx;
						height: 40rpx;
					}
				}
			}

			.modal-content {
				width: 100%;
				height: 240rpx;

				// border: 1px solid;
				.modal-content-line {
					display: flex;
					justify-content: center;
					align-items: center;
					margin: 30rpx 30rpx;
				}

				.modal-content-money {
					width: 100%;
					height: 100rpx;
					margin-top: -10rpx;
					display: flex;
					justify-content: center;
					align-items: center;

					// border:1px solid;
					.rmb {
						font-size: 40rpx;
						color: #333333;
						margin-right: 10rpx;
						font-weight: 600;
						margin-top: 15rpx;
					}

					.rmb-num {
						font-size: 66rpx;
						color: #333333;
						font-weight: 600;
					}
				}

				.modal-content-type {
					width: 92%;
					margin: 0 auto;
					height: 80rpx;
					// border: 1px solid;
					display: flex;
					justify-content: space-between;
					align-items: center;

					.modal-content-type-left {}

					.modal-content-type-right {
						display: flex;
						justify-content: center;
						align-items: center;

						image {
							width: 40rpx;
							height: 100%;
						}

						text {
							margin-left: 6rpx;
							color: #333333;
							font-size: 26rpx;
						}
					}
				}
			}

			&>.pay-code {
				padding-bottom: 10rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				text-align: center;
				position: relative;

				&>input {
					position: absolute;
					top: 0;
					left: -100%;
					width: 200%;
					height: 100%;
					text-align: left;
					z-index: 9;
					opacity: 1;
				}

				&>.box {
					display: flex;
					align-items: center;
					justify-content: center;
					position: relative;
					width: 80rpx;
					height: 80rpx;
					margin-right: 10rpx;
					font-size: 22px;
					line-height: 90rpx;
					box-sizing: border-box;
					background-color: #F2F2F2;
					border-radius: 2px;

					&:last-child {
						margin-right: 0;
					}
				}

				&>.active {
					border: 2rpx solid #cccccc;

					@keyframes twinkling {
						0% {
							opacity: 0.1;
						}

						50% {
							opacity: 0.8;
						}

						100% {
							opacity: 0.1;
						}
					}

					&>.line {
						display: block;
						position: absolute;
						left: 50%;
						top: 50%;
						transform: translate(-50%, -50%);
						width: 2upx;
						height: 40upx;
						background: #333333;
						animation: twinkling 1s infinite ease;
					}
				}
			}

			.repwd {
				height: 62rpx;
				margin-bottom: -30rpx;
				font-size: 24rpx;
				color: #999999;
				// border: 1px solid;
				width: 92%;
				margin: 0 auto;
				display: flex;
				justify-content: flex-end;
				align-items: center;
			}

			&>.button {
				display: flex;
				align-items: center;
				justify-content: center;
				width: 180rpx;
				height: 70rpx;
				margin-top: 60rpx;
				border-radius: 50rpx;
				background-color: #FCC928;

				&:active {
					opacity: 0.7;
				}
			}

			&>.close {
				position: absolute;
				right: 30rpx;
				top: 30rpx;
				width: 42rpx;
				height: 42rpx;
			}
		}
	}

	.errorpw {
		animation: swing 1s .15s linear 1;
	}

	@keyframes swing {

		10%,
		90% {
			transform: translate(-4rpx, 0);
		}

		20%,
		80% {
			transform: translate(+4rpx, 0);
		}

		30%,
		70% {
			transform: translate(-6rpx, 0);
		}

		40%,
		60% {
			transform: translate(+6rpx, 0);
		}

		50% {
			transform: translate(-8rpx, 0);
		}
	}

	.month-card-info-right-youhui {
		width: 220rpx;
		height: 28rpx;
		background-color: rgba(254, 74, 40, .2);
		border-radius: 4rpx;
		margin-right: 140rpx;
		line-height: 28rpx;
		font-size: 24rpx;
		font-weight: 500;
		color: #FE4B28;
		position: absolute;
		right: 0rpx;

		&>image {
			width: 22rpx;
			height: 22rpx;
			position: relative;
			margin: 0 12rpx;
			top: 50%;
			transform: translateY(-50%);
		}
	}

	.mian-fuwufei {
		width: 690rpx;
		height: 80rpx;
		background: #6ED4B5;
		border-radius: 12rpx;
		margin-bottom: -20rpx;

		&>text {
			margin-left: 30rpx;
			font-size: 24rpx;
			font-weight: 500;
			color: #FFFFFF;
			line-height: 60rpx;
		}
	}

	.yk-jianmian {
		// width: 440rpx;
		// height: 286rpx;
		// background-color: rgba(0, 0, 0, .6);
		width: 100vw;
		height: 100vh;
		background-color: rgba(0, 0, 0, .8);
		border-radius: 12rpx;
		position: fixed;
		top: 0;
		left: 0;
		// top: 50%;
		// left: 50%;
		// transform: translate(-50%, -50%);
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;

		&>image {
			width: 104rpx;
			height: 104rpx;
			margin-top: 40rpx;
		}
	}

	.yk-jianmian-title {
		margin-top: 28rpx;
		font-size: 32rpx;
		font-weight: bold;
		color: #FFFFFF;
		line-height: 46rpx;
	}

	.yk-jianmian-cardNumber {
		font-size: 24rpx;
		font-weight: 400;
		color: #FFFFFF;
		line-height: 50rpx;
	}

	.showYkJianmianTime {
		font-size: 28rpx;
		font-weight: 400;
		color: #FFFFFF;
		line-height: 120rpx;
	}
</style>